<?php

	function getSmarty()
	{
		$smarty = new Smarty();
		$smarty -> template_dir = SITE_ROOT. "/templates/";
		$smarty -> compile_dir = SITE_ROOT . "/templates_c";
		return $smarty;
	}

	function buildLayout( $tplName, $vars )
	{
		$smarty = getSmarty();

		foreach ( $vars as $key => $value )
		{
			$smarty->assign( $key, $value );
		}

		$smarty->display( $tplName );
	}

	function getView( $tplName, $vars )
	{
		$smarty = getSmarty();

		foreach ( $vars as $key => $value )
		{
			$smarty->assign( $key, $value );
		}
		$content = $smarty->fetch( $tplName );
		return $content;
	}

?>